<form class="form-horizontal" role="form" id="deviceForm">
    <input type="hidden" name="id">
    <div class="form-group">
        <label class="col-sm-3 control-label">设备标识</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" name="accessKey" updateonlyread/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">设备名称</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" name="deviceName" onlyread/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">设备描述</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" name="deviceDescribe" onlyread/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">设备状态</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" name="deviceStatus" onlyread/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">设备类别</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" name="deviceType" onlyread/>
        </div>
    </div>
</form>
<script>
    $('#deviceForm').find('[name="accessKey"]').keyup(function () {
        $.get("${basePath}/manager/findDeviceByAccessKy", {key: $(this).val()}, function (value) {
            if (value != "") {
                $('#EditEntity').find("form input").each(function () {
                    $(this).val(value[$(this).attr("name")]);
                })
            } else {
                $('#EditEntity').find("form input:not([name='accessKey'])").val("");
            }
        })
    })
</script>

